import { useEffect } from 'react';
import { 
    StatusBar,
    Text, 
    View,
    Image
  } from 'react-native';
import { AntDesign } from '@expo/vector-icons';

  export default function Detail({navigation,route}) {
    const userName = route.params.userName
    console.log('route',route)

    useEffect(()=>{
      navigation.setOptions(
        {
          // title:userName,
          // headerShown:true,
          headerBackVisible:false,//隐藏默认的返回箭头
          headerTitle:()=>(   //设置右上角头部图标
            <Text>{userName}</Text>
          ),
          headerRight:()=>(
            <AntDesign name="plus" size={24} color="black" />
          ),
          headerLeft:()=>(  //设置左上角头部图标
            <AntDesign onPress={navigation.goBack} name="left" size={24} color="black" /> 
          ),
        }
      )
    })
    return(
      <View>
        <Text>
            Detail
        </Text>
        <StatusBar/>
      </View>
    )
  }